package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum ReturnStatusEnum {
    /**
     * 退货状态(1:未确认,3.已退货,4.已完成,5.已关闭)
     */
    RETURN_STATUS_UNCONFIRM(1, "未确认"),
    RETURN_STATUS_DISPATCH(3, "已退货"),
    RETURN_STATUS_COMPLETE(4, "已完成"),
    RETURN_STATUS_CANCELED(5, "已取消");

    private Integer id;
    private String name;

    ReturnStatusEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        ReturnStatusEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static ReturnStatusEnum getById(Integer id) {
        for (ReturnStatusEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

}
